<template>
  <el-tree-select v-model="name" :data="trees" :render-after-expand="false" :props="defaultProps" accordion :check-strictly="true" />
</template>

<script setup lang="ts">
import { onMounted } from "vue";
import useCounterStore from "@/store/counter";
const counter = useCounterStore();
const { proxy } = getCurrentInstance();
let props = defineProps(["modelValue"]);
const emit = defineEmits(["update:modelValue"]);
const name = computed({
  get() {
    return props.modelValue;
  },
  set(value: Number) {
    emit("update:modelValue", value);
  },
});
let trees = ref([]);
onMounted(() => {
  getInfo();
});
let defaultProps = computed(() => {
  return {
    label: "name",
    value: "_id",
  };
});
let getInfo = async () => {
  let arr = await proxy.$apis.depList({});
  trees.value = proxy.$utils.transformArray(arr, "_id", "parentId");
};
</script>

<style lang="scss" scoped>
</style>
